package com.itheima.practise;

import java.util.Scanner;

public class Test03 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = new int[5];
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入第" + (i + 1) + "门的成绩");
            int score = sc.nextInt();
            if (score <= 100 && score >= 0) {
                arr[i] = score;
            } else {
                System.out.println("您输入的数据有误");
                i--;
            }
        }
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }
        int min = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        System.out.println("小明的平均分为:" + sum / 5.0);
        System.out.println("小明的最高分为:" + max);
        System.out.println("小明的最低分为:" + min);
    }
}
